
#include <stdint.h>
#include <sys/time.h>
#include <stdio.h>
#include <NDL.h>

void test_gettimeofday() {
    uint32_t ms = 500;
    struct timeval cur_tv, start_tv;
    gettimeofday(&start_tv, NULL);
    while (1) {
        gettimeofday(&cur_tv, NULL);
        if ((cur_tv.tv_sec - start_tv.tv_sec) * 1000 + (cur_tv.tv_usec - start_tv.tv_usec) / 1000 < ms) continue;
        printf("ms = %u\n", ms);
        ms += 500;
    }
}

void test_NDL_GetTicks() {
    NDL_Init(0);
    uint32_t ms = 500;
    while (1) {
        if (NDL_GetTicks() < ms) continue;
        printf("ms = %u\n", ms);
        ms += 500;
    }
}

int main() {
    // test_gettimeofday();
    test_NDL_GetTicks();
    return 0;
}
